<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
<html>
<head>
<title>渠道汇总</title>
</head>
<body>
<jsp:include page="_headMike.jsp"></jsp:include>
<form class="form-inline" action="" method="post">
  <div class="datepicker input-append">
    <input data-format="yyyy-MM-dd" type="text" value="${selectDate}" name="selectDate"></input>
    <span class="add-on">
      <i data-time-icon="icon-time" data-date-icon="icon-calendar">
      </i>
    </span>
  </div>
  <button type="submit" class="btn">查询</button>
</form>

<table class="table table-bordered">
  <thead>
    <tr> 	 	 			 	
      <th>唱歌次数</th>
      <c:forEach var="t" items="${result}">
      <th>
		${ t.key==11 ? '11~20' : t.key==21 ? '21~30' : t.key==31 ? '31~40' : t.key==41 ? '41~50' : t.key==51 ? '51以上' : t.key}次
	  </th> 
	  </c:forEach>
	 <th>
		合计
	</th> 
    </tr>
  </thead>
  <tbody>
  <c:set var="peopleSum" value="0"/>
  <c:set var="timesSum" value="0"/>
   <c:forEach begin="1" end="4" varStatus="vs1">
   		 <tr>
   		 		 <c:if test="${vs1.count == 1 }">
				       <td>5级及以下</td>
		         </c:if>
		         <c:if test="${vs1.count == 2 }">
				       <td>6级-10级</td>
		         </c:if>
		         <c:if test="${vs1.count == 3 }">
				       <td>11级-20级 </td>
		         </c:if>
		         <c:if test="${vs1.count == 4 }">
				       <td>20级以上</td>
		         </c:if>
        	 <c:set var="rowSum" value="0"/>
        	 <c:set var="rowTimesSum" value="0"/>
			  <c:forEach var="m" items="${result}" >
				 	 <c:if test="${vs1.count == 1 }">
				       <td>${m.value.a1.people}</td>
				       <c:set var="rowSum" value="${rowSum + m.value.a1.people }"/>
				       <c:set var="rowTimesSum" value="${rowTimesSum + m.value.a1.times }"/>
			         </c:if>
				 	 <c:if test="${vs1.count == 2 }">
				       <td>${m.value.a2.people}</td>
				       <c:set var="rowSum" value="${rowSum + m.value.a2.people }"/>
				       <c:set var="rowTimesSum" value="${rowTimesSum + m.value.a2.times }"/>
			         </c:if>
				 	 <c:if test="${vs1.count == 3 }">
				       <td>${m.value.a3.people}</td>
				       <c:set var="rowSum" value="${rowSum + m.value.a3.people }"/>
				       <c:set var="rowTimesSum" value="${rowTimesSum + m.value.a3.times }"/>
			         </c:if>
				 	 <c:if test="${vs1.count == 4 }">
				       <td>${m.value.a4.people}</td>
				       <c:set var="rowSum" value="${rowSum + m.value.a4.people }"/>
				       <c:set var="rowTimesSum" value="${rowTimesSum + m.value.a4.times }"/>
			         </c:if>
			  </c:forEach>
			  <c:set var="peopleSum" value="${peopleSum + rowSum}"/>
			  <c:set var="timesSum" value="${timesSum + rowTimesSum}"/>
			  <td>
			  	${rowSum}
			  </td>
	    </tr>
    </c:forEach>
    
    
    
   	     <tr>
			  <td>
				唱歌人数合计
			  </td>
		  <c:forEach var="m" items="${result}" >
       		   <c:set var="colSum" value="0"/>
		       <c:set var="colSum" value="${colSum + m.value.a1.people }"/>
		       <c:set var="colSum" value="${colSum + m.value.a2.people }"/>
		       <c:set var="colSum" value="${colSum + m.value.a3.people }"/>
		       <c:set var="colSum" value="${colSum + m.value.a4.people }"/>
		        <td>
	  			${colSum}
	  			</td>
		  </c:forEach>
			<td>
				${peopleSum}
		  </td>				  
      </tr>
      <tr>
			  <td>
				占总唱歌人数比
			  </td>
  		 <c:forEach var="m" items="${result}" >
        		   <c:set var="colSum" value="0"/>
	       <c:set var="colSum" value="${colSum + m.value.a1.people }"/>
	       <c:set var="colSum" value="${colSum + m.value.a2.people }"/>
	       <c:set var="colSum" value="${colSum + m.value.a3.people }"/>
	       <c:set var="colSum" value="${colSum + m.value.a4.people }"/>
	        <td>
  			<fmt:formatNumber value="${colSum / peopleSum * 100}" pattern="#0.0#"/> %
  			</td>
		 </c:forEach>
			<td>
				
		  </td>				  
      </tr>
      
      <tr>
			  <td>
				唱歌次数合计
			  </td>
		<c:forEach var="m" items="${result}" >
   		   <c:set var="colSum" value="0"/>
	       <c:set var="colSum" value="${colSum + m.value.a1.times }"/>
	       <c:set var="colSum" value="${colSum + m.value.a2.times }"/>
	       <c:set var="colSum" value="${colSum + m.value.a3.times }"/>
	       <c:set var="colSum" value="${colSum + m.value.a4.times }"/>
	       	<td>
  			${colSum}
  			</td>
	    </c:forEach>
			<td>
				${timesSum}
		  </td>				  
      </tr>
      <tr>
			  <td>
				占总唱歌次数比
			  </td>
							  <c:forEach var="m" items="${result}" >
					          		   <c:set var="colSum" value="0"/>
								       <c:set var="colSum" value="${colSum + m.value.a1.times }"/>
								       <c:set var="colSum" value="${colSum + m.value.a2.times }"/>
								       <c:set var="colSum" value="${colSum + m.value.a3.times }"/>
								       <c:set var="colSum" value="${colSum + m.value.a4.times }"/>
								      	 <td>
								       		<fmt:formatNumber value="${colSum / timesSum * 100} " pattern="#0.0#"/>%
							  			</td>
							  </c:forEach>
			<td>
				
		  </td>				  
      </tr>
      
  </tbody>
</table>
<div>
备注：<br/>
贡献了多少首歌就是唱歌次数，唱歌次数按有效上麦来统计(大于1分钟）<br/>
</div>
<div>
备注：<br/>
新用户，新注册用户<br/>
老用户，非今天注册的用户<br/>
唱歌次数，按有效上麦来统计(大于1分钟）<br/>
</div>
</body>
</html>
 